﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace GiaoDien
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ServiceKD.ServiceSoapClient proxy = new GiaoDien.ServiceKD.ServiceSoapClient("ServiceSoap");
            if (Request.QueryString["MaDanhMuc"] != null)
            {
                int MaDanhMuc = Int32.Parse(Request.QueryString["MaDanhMuc"].ToString());

                
                ServiceKD.SanPham[] dssp = proxy.laySanPham(MaDanhMuc);

                CollectionPager1.PageSize = 12;
                CollectionPager1.DataSource = dssp;
                CollectionPager1.BindToControl = DataList1;
                DataList1.DataSource = CollectionPager1.DataSourcePaged;
                DataList1.DataBind();
            }
            else
            {
                ServiceKD.SanPham[] dssp = proxy.layHetSanPham();

                CollectionPager1.PageSize = 12;
                CollectionPager1.DataSource = dssp;
                CollectionPager1.BindToControl = DataList1;
                DataList1.DataSource = CollectionPager1.DataSourcePaged;
                DataList1.DataBind();
            }
            
        }
    }
}
